home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / bignum_37_28.lha / BigNum / developpers / Autodocs / BigNum.doc next >
Text File  |  1997-02-11  |  20KB  |  1,204 lines

  1. TABLE OF CONTENTS
  2.  
  3. BigNum.library/BigNumInit
  4. BigNum.library/BigNumFree
  5. BigNum.library/BigNumSetNul
  6. BigNum.library/BigNumSize
  7. BigNum.library/BigNumIsEven
  8. BigNum.library/BigNumAbsBigNum
  9. BigNum.library/BigNumIsNul
  10. BigNum.library/BigNumIsPositive
  11. BigNum.library/BigNumNegative
  12. BigNum.library/BigNumAdd
  13. BigNum.library/BigNumDigitAdd
  14. BigNum.library/BigNumDiv
  15. BigNum.library/BigNumDigitDiv
  16. BigNum.library/BigNumRightShift
  17. BigNum.library/BigNumModulo
  18. BigNum.library/BigNumEDiv
  19. BigNum.library/BigNumMul
  20. BigNum.library/BigNumDigitMul
  21. BigNum.library/BigNumLeftShift
  22. BigNum.library/BigNumSub
  23. BigNum.library/BigNumDigitSub
  24. BigNum.library/BigNumDisplay
  25. BigNum.library/BigNumPrint
  26. BigNum.library/BigNumStrToBigNum
  27. BigNum.library/BigNumToStr
  28. BigNum.library/BigNumIntToBigNum
  29. BigNum.library/BigNumToInt
  30. BigNum.library/BigNumCompare
  31. BigNum.library/BigNumFastCompare
  32. BigNum.library/BigNumRnd
  33. BigNum.library/BigNumPgcd
  34. BigNum.library/BigNumPuiModulo
  35. BigNum.library/BigNumSqrt
  36. BigNum.library/BigNumSwap
  37. BigNum.library/BigNumAssign
  38. BigNum.library/BigNumPower2
  39. BigNum.library/BigNumLucasLehmer
  40. BigNum.library/BigNumDiffCarre
  41. BigNum.library/BigNumRho
  42. BigNum.library/BigNumBrutePrime
  43. BigNum.library/BigNumErrorStatus
  44. BigNum.library/BigNumInfo
  45. BigNum.library/BigNumInit
  46.  
  47.    NAME
  48.     BigNumInit -- Allocates a new BigNum
  49.  
  50.    SYNOPSIS
  51.     big = BigNumInit()
  52.     D0
  53.  
  54.     PtrBigNum BigNumInit(void)
  55.  
  56.    FUNCTION
  57.     Allocates a new BigNum.
  58.     If there is no more memory, an error occurs.
  59.     WARNING : BigNumInit will always return a valid pointer.
  60.  
  61.    RESULT
  62.     big    A BigNum
  63.  
  64.    WARNING
  65.     No assumption can be made on the content of this NewBigNum.
  66.     BigNumIsNul will always return TRUE, that's all.
  67.  
  68.    SEE ALSO
  69.     BigNumFree(), BigNumIsNul(), BigNumErrorStatus()
  70.  
  71.  
  72. BigNum.library/BigNumFree
  73.  
  74.    NAME
  75.     BigNumFree -- Unallocates one or more BigNums at a time
  76.  
  77.    SYNOPSIS
  78.     BigNumFree( number )
  79.             D0
  80.  
  81.     void BigNumFree(int)
  82.  
  83.    FUNCTION
  84.     Unallocate one or several BigNums that ware previously allocated
  85.  
  86.  
  87.     Example :
  88.  
  89.         x=InitBigNum();
  90.         y=InitBigNum();
  91.         z=InitBigNum();
  92.         BigNumFree(2);
  93.  
  94.         will free y and z.
  95.  
  96.    INPUTS
  97.     number    BigNums number to free
  98.  
  99.    WARNING
  100.     DO NOT free more BigNum than allocated with BigNumInit()
  101.     When calling CloseLibrary, BigNum.library tests if all the allocated
  102.     BigNum were freed.
  103.  
  104.    SEE ALSO
  105.     BigNumInit()
  106.  
  107.  
  108. BigNum.library/BigNumSetNul
  109.  
  110.    NAME
  111.     BigNumSetNul -- Set a bignum to zero
  112.  
  113.    SYNOPSIS
  114.     BigNumSetNul( big )
  115.                   A0
  116.  
  117.     void BigNumSetNul(PtrBigNum)
  118.  
  119.    FUNCTION
  120.     Sets a BigNum to zero.
  121.  
  122.    INPUTS
  123.     big    The BigNum to set to.
  124.  
  125.    RESULT
  126.     big
  127.  
  128.    SEE ALSO
  129.     BigNumIsNul()
  130.  
  131.  
  132. BigNum.library/BigNumSize
  133.  
  134.    NAME
  135.     BigNumSize -- Give the size of a BigNum
  136.  
  137.    SYNOPSIS
  138.     res = BigNumSize( big )
  139.     D0                A0
  140.  
  141.     int BigNumSize(PtrBigNum)
  142.  
  143.    INPUTS
  144.     big    The bignum you want to know the size.
  145.  
  146.    RESULT
  147.     The size in WORDs
  148.  
  149.    NOTES
  150.     The size can be interpreted as the lowest N that verify :
  151.  
  152.         abs(big) < 32768^N
  153.  
  154.  
  155. BigNum.library/BigNumIsEven
  156.  
  157.    NAME
  158.     BigNumIsEven -- Test if a BigNum is even
  159.  
  160.    SYNOPSIS
  161.     res = BigNumIsEven( big )
  162.     D0.w                A0
  163.  
  164.     short BigNumIsEven(PtrBigNum)
  165.  
  166.    FUNCTION
  167.     Test if a BigNum is even.
  168.  
  169.    INPUTS
  170.     big    The BigNum you want to test
  171.  
  172.    RESULT
  173.     1 if even
  174.     0 if odd
  175.  
  176.  
  177. BigNum.library/BigNumAbsBigNum
  178.  
  179.    NAME
  180.     BigNumAbsBigNum -- Compute the absolute of a BigNum
  181.  
  182.    SYNOPSIS
  183.     BigNumAbsBigNum( bigR )
  184.                      A0
  185.  
  186.     void BigNumAbsBigNum (PtrBigNum)
  187.  
  188.    FUNCTION
  189.     It will perform :
  190.     big=abs(big)
  191.  
  192.    INPUTS
  193.     bigR    The BigNum to get the abs. value.
  194.  
  195.    RESULT
  196.     bigR    The BigNum to put the abs. value.
  197.  
  198.    NOTES
  199.     BigNumAbsBigNum(x,x) can be done.
  200.  
  201.    SEE ALSO
  202.     BigNumIspositive(), BigNumAssign()
  203.  
  204.  
  205. BigNum.library/BigNumIsNul
  206.  
  207.    NAME
  208.     BigNumIsNul -- Test if zero
  209.  
  210.    SYNOPSIS
  211.     res = BigNumIsNul( big )
  212.     D0.w               A0
  213.  
  214.     short BigNumIsNul(PtrBigNum)
  215.  
  216.    FUNCTION
  217.     Test if a BigNum is equal to zero.
  218.  
  219.    INPUTS
  220.     big    The BigNum you want to test.
  221.  
  222.    RESULT
  223.     1 if big=0
  224.     0 otherwise
  225.  
  226.    SEE ALSO
  227.     BigNumSetNul()
  228.  
  229.  
  230. BigNum.library/BigNumIsPositive
  231.  
  232.    NAME
  233.     BigNumIsPositive -- Test if positive
  234.  
  235.    SYNOPSIS
  236.     res = BigNumIsPositive( big )
  237.     D0.w                    A0
  238.  
  239.     short BigNumIsPositive(PtrBigNum)
  240.  
  241.    FUNCTION
  242.     Test if a BigNum is positive.
  243.  
  244.    INPUTS
  245.     big    The BigNum to test
  246.  
  247.    RESULT
  248.     1 if big>=0
  249.     0 otherwise
  250.  
  251.    SEE ALSO
  252.     BigNumIsNegative()
  253.  
  254.  
  255. BigNum.library/BigNumIsNegative
  256.  
  257.    NAME
  258.     BigNumIsNegative -- Test if negative
  259.  
  260.    SYNOPSIS
  261.     res = BigNumIsNegative( big )
  262.     D0.w                    A0
  263.  
  264.     short BigNumIsNegative(PtrBigNum)
  265.  
  266.    FUNCTION
  267.     Test if a BigNum is negative.
  268.  
  269.    INPUTS
  270.     big    The BigNum to test
  271.  
  272.    RESULT
  273.     1 if big<0
  274.     0 otherwise
  275.  
  276.    BUGS
  277.     As you saw, 0 is considered as a positive number. ;)
  278.  
  279.    SEE ALSO
  280.     BigNumIsPositive()
  281.  
  282.  
  283. BigNum.library/BigNumAdd
  284.  
  285.    NAME
  286.     BigNumAdd -- Add two BigNums
  287.  
  288.    SYNOPSIS
  289.     BigNumAdd( big1 , big2 , bigR)
  290.            A0      A1     A2
  291.  
  292.     void BigNumAdd(PtrBigNum,PtrBigNum,PtrBigNum)
  293.  
  294.    FUNCTION
  295.     Add two BigNums
  296.     bigR=big1+big2
  297.  
  298.    INPUTS
  299.     big1,big2    The BigNums you want to Add.
  300.  
  301.    RESULT
  302.     bigR    = big1 + big2
  303.  
  304.    NOTES
  305.     BigNumAdd(x,x,x) is right !
  306.  
  307.    SEE ALSO
  308.     BigNumDigitAdd(), BigNumSub()
  309.  
  310.  
  311. BigNum.library/BigNumDigitAdd
  312.  
  313.    NAME
  314.     BigNumDigitAdd -- Add an integer to a BigNum
  315.  
  316.    SYNOPSIS
  317.     BigNumDigitAdd( big , number )
  318.             A0    D0
  319.  
  320.     void BigNumDigitAdd(PtrBigNum,int)
  321.  
  322.    FUNCTION
  323.     Add an integer to a BigNum and return the result in the BigNum.
  324.     big+=number
  325.  
  326.    INPUTS
  327.     big    The BigNum
  328.     number    The number
  329.  
  330.    RESULT
  331.     big    = big + number
  332.  
  333.    NOTES
  334.     Add(x,1,x) is allowed.
  335.  
  336.    SEE ALSO
  337.     BigNumAdd(), BigNumDigitSub()
  338.  
  339.  
  340. BigNum.library/BigNumDiv
  341.  
  342.    NAME
  343.     BigNumDiv -- Divide two BigNums
  344.  
  345.    SYNOPSIS
  346.     BigNumDiv( big1 , big2, bigR)
  347.            A0      A1    A2
  348.  
  349.     void BigNumDiv(PtrBigNum,PtrBigNum,PtrBigNum)
  350.  
  351.    FUNCTION
  352.     Compute the following operation :
  353.     bigR=big1/big2
  354.  
  355.    INPUTS
  356.     big1,big2
  357.  
  358.    RESULT
  359.     bigR    = big1 / big2
  360.  
  361.    WARNING
  362.     big1,big2 and bigR MUST be different BigNums !
  363.     BigNumDiv(x,y,x) is unpredictable !!
  364.  
  365.    NOTES
  366.     If big2 is zero, an error will occur and BigR is set to zero.
  367.  
  368.    SEE ALSO
  369.     BigNumDigitDiv(), BigNumEDiv(), BigNumModulo()
  370.  
  371.  
  372. BigNum.library/BigNumDigitDiv
  373.  
  374.    NAME
  375.     BigNumDigitDiv -- Divide a BigNum by an integer
  376.  
  377.    SYNOPSIS
  378.     BigNumDigitDiv( big1 , number , bigR)
  379.             A0     D0    A1
  380.  
  381.     void BigNumDigitDiv(PtrBigNum,int,PtrBigNum)
  382.  
  383.    FUNCTION
  384.     Compute the following operation :
  385.     bigR=big1/number
  386.  
  387.    INPUTS
  388.     big1    The BigNum you want to divide
  389.     number    The integer divisor
  390.  
  391.    RESULT
  392.     bigR    = big1/number
  393.  
  394.    NOTES
  395.     If number is zero an error will occur and bigR is set to zero.
  396.  
  397.     DigitDiv(x,4,x) is allowed.
  398.  
  399.     If number is a power of two, use BigNumRightShift for speed.
  400.  
  401.    SEE ALSO
  402.     BigNumDiv(), BigNumDigitMul(), BigNumRightShift()
  403.  
  404. BigNum.library/BigNumRightShift
  405.  
  406.    NAME
  407.     BigNumRightShift -- Shift a BigNum to the right
  408.  
  409.    SYNOPSIS
  410.     BigNumRightShift( big , number )
  411.               A0     D0
  412.  
  413.     void BigNumRightShift(PtrBigNum,int)
  414.  
  415.    FUNCTION
  416.     Shift a BigNum 'number' timers to the left.
  417.  
  418.    INPUTS
  419.     big    The BigNum you want to move.
  420.     number    The number of steps.
  421.  
  422.    RESULT
  423.     big    = big >> number
  424.     or
  425.     big    = big / (2^number)
  426.  
  427.    NOTES
  428.     If number equals zero, nothing is done.
  429.     If number is negative BigNumLeftShift is called.
  430.  
  431.    SEE ALSO
  432.     BigNumLeftShift(), BigNumPower2()
  433.  
  434.  
  435. BigNum.library/BigNumModulo
  436.  
  437.    NAME
  438.     BigNumModulo -- Modulo function
  439.  
  440.    SYNOPSIS
  441.     BigNumModulo( big , modulo , bigR )
  442.               A0     A1        A2
  443.  
  444.     void BigNumModulo(PtrBigNum,PtrBigNum,PtrBigNum)
  445.                     ~~~~~~~~~
  446.  
  447.    FUNCTION
  448.     Compute the modulo function between two BigNums.
  449.  
  450.    INPUTS
  451.     big,modulo    Two BigNums
  452.  
  453.    RESULT
  454.     bigR    = big % modulo
  455.  
  456.    WARNING
  457.     The implementation of special cases like negative numbers can be
  458.     modified from one version of the library to the other.
  459.     You'll be warned !
  460.  
  461.     big1,modulo and bigR MUST be different BigNums !
  462.     BigNumModulo(x,y,x) is unpredictable !!
  463.  
  464.    NOTES
  465.     If modulo is zero, an error occurs and bigR is set to zero !
  466.  
  467.    SEE ALSO
  468.     BigNumPuiModulo()
  469.  
  470.  
  471. BigNum.library/BigNumEDiv
  472.  
  473.    NAME
  474.     BigNumEDiv -- Compute quotient and reminder
  475.  
  476.    SYNOPSIS
  477.     BigNumEDiv( big1 , big2 , bigQ , bigR )
  478.             A0        A1      A2     A3
  479.  
  480.     void BigNumEDiv(PtrBigNum,PtrBigNum,PtrBigNum,PtrBigNum)
  481.  
  482.    FUNCTION
  483.     Compute the quotient and the reminder in one pass !
  484.  
  485.    INPUTS
  486.     big1,big2    The BigNum to perform the operation
  487.  
  488.    RESULT
  489.     bigQ, bigR    Quotient and Remainder
  490.             big1 = bigR + bigQ x big2
  491.  
  492.    WARNING
  493.     The implementation of special cases like negative numbers can be
  494.     modified from one version of the library to the other.
  495.     You'll be warned !
  496.  
  497.     big1,big2,bigQ and bigR MUST be different BigNums !
  498.     BigNumEDiv(x,y,x,t) is unpredictable !!
  499.  
  500.    SEE ALSO
  501.     BigNumDiv(), BigNumModulo()
  502.  
  503.  
  504. BigNum.library/BigNumMul
  505.  
  506.    NAME
  507.     BigNumMul -- Multiplication between BigNums
  508.  
  509.    SYNOPSIS
  510.     BigNumMul( big1 , big2 , bigR )
  511.            A0      A1     A2
  512.  
  513.     void BigNumMul(PtrBigNum,PtrBigNum,PtrBigNum)
  514.  
  515.    FUNCTION
  516.     Multiply two BigNums together.
  517.  
  518.    INPUTS
  519.     big1,big2    Two BigNums
  520.  
  521.    RESULT
  522.     bigR    = big1 x big2
  523.  
  524.    WARNING
  525.     big1,big2 and bigR MUST be different BigNums !
  526.     BigNumMul(x,y,x) is unpredictable !!
  527.  
  528.     If bigR can't contain the BigNum, an error occurs and bigR is
  529.     set to zero.
  530.  
  531.    NOTES
  532.     This function uses a different routine when the numbers are big.
  533.     Speed Gain ~30%
  534.  
  535.    SEE ALSO
  536.     BigNumDigitMul(), BigNumDiv()
  537.  
  538.  
  539. BigNum.library/BigNumDigitMul
  540.  
  541.    NAME
  542.     BigNumDigitMul -- Multiply a BigNum with an integer
  543.  
  544.    SYNOPSIS
  545.     BigNumDigitMul( big , number )
  546.             A0    D0
  547.  
  548.     void BigNumDigitMul(PtrBigNum,int)
  549.  
  550.    FUNCTION
  551.     Multiply a BigNum with an integer.
  552.  
  553.    INPUTS
  554.     big    |    The operandes
  555.     number    |
  556.  
  557.    RESULT
  558.     big    = big * number
  559.  
  560.    NOTES
  561.     If the result is too big, an error occurs and big is set to zero.
  562.  
  563.     If number is a power of two, use BigNulLeftShift for speed.
  564.  
  565.    SEE ALSO
  566.     BigNumMul(), BigNumDigitDiv(),    BigNumLeftShift()
  567.  
  568.  
  569. BigNum.library/BigNumLeftShift
  570.  
  571.    NAME
  572.     BigNumLeftShift -- Shift a BigNum to the left
  573.  
  574.    SYNOPSIS
  575.     BigNumLeftShift( big , number )
  576.              A0    D0
  577.  
  578.     void BigNumLeftShift(PtrBigNum,int)
  579.  
  580.    INPUTS
  581.     big     |  The operandes
  582.     number  |
  583.  
  584.    RESULT
  585.     big    = big << number
  586.  
  587.    NOTES
  588.     If the result is too big, an error occurs and big is set to zero.
  589.  
  590.    SEE ALSO
  591.     BigNumRightShift(), BigNumPower2()
  592.  
  593.  
  594. BigNum.library/BigNumSub
  595.  
  596.    NAME
  597.     BigNumSub -- Substracte two BigNums
  598.  
  599.    SYNOPSIS
  600.     BigNumSub( big1 , big2 , bigR )
  601.            A0      A1     A2
  602.  
  603.     void BigNumSub(PtrBigNum,PtrBigNum,PtrBigNum)
  604.  
  605.    FUNCTION
  606.     Substract two BigNums together.
  607.  
  608.    INPUTS
  609.     big1,big2    The operandes
  610.  
  611.    RESULT
  612.     bigR    = big1 - big2
  613.  
  614.    NOTES
  615.     BigNumSub(x,x,x) is allowed.
  616.  
  617.    SEE ALSO
  618.     BigNumDigitSub(), BigNumAdd()
  619.  
  620.  
  621. BigNum.library/BigNumDigitSub
  622.  
  623.    NAME
  624.     BigNumDigitSub -- Substract an integer from a BigNum
  625.  
  626.    SYNOPSIS
  627.     BigNumDigitSub( big , number )
  628.             A0    D0
  629.  
  630.     void BigNumDigitSub(PtrBigNum,int)
  631.  
  632.    FUNCTION
  633.     Substract an integer from a BigNum.
  634.  
  635.    INPUTS
  636.     big    BigNum    |    The operandes
  637.     number    integer    |
  638.  
  639.    RESULT
  640.     big    = big - number
  641.  
  642.    SEE ALSO
  643.     BigNumSub(), BigNumDigitAdd()
  644.  
  645.  
  646. BigNum.library/BigNumDisplay
  647.  
  648.    NAME
  649.     BigNumDisplay -- Display debugging information of a BigNum
  650.  
  651.    SYNOPSIS
  652.     BigNumDisplay( big )
  653.                A0
  654.  
  655.     void BigNumDisplay(PtrBigNum)
  656.  
  657.    FUNCTION
  658.     Display a BigNum for debugging purposes.
  659.  
  660.    INPUTS
  661.     big    The BigNum to be displayed.
  662.  
  663.    NOTES
  664.     Not for common use !
  665.  
  666.    SEE ALSO
  667.     BigNumPrint()
  668.  
  669.  
  670. BigNum.library/BigNumPrint
  671.  
  672.    NAME
  673.     BigNumPrint -- Print a BigNum
  674.  
  675.    SYNOPSIS
  676.     BigNumPrint( big )
  677.              A0
  678.  
  679.     void BigNumPrint(PtrBigNum)
  680.  
  681.    FUNCTION
  682.     Display a BigNum.
  683.  
  684.    INPUTS
  685.     big    The BigNum to be displayed.
  686.  
  687.    SEE ALSO
  688.     BigNumDisplay()
  689.  
  690.  
  691. BigNum.library/BigNumStrToBigNum
  692.  
  693.    NAME
  694.     BigNumStrToBigNum -- Convert an ASCII string to a BigNum
  695.  
  696.    SYNOPSIS
  697.     BigNumStrToBigNum( big , string )
  698.                A0    A1
  699.  
  700.     void BigNumStrToBigNum(PtrBigNum,char *)
  701.  
  702.    FUNCTION
  703.     Convert an ASCII string to a BigNum.
  704.  
  705.    INPUTS
  706.     string    The ASCII string
  707.  
  708.    RESULT
  709.     big    A BigNum.
  710.  
  711.    SEE ALSO
  712.     BigNumToStr(), BigNumPrint()
  713.  
  714.  
  715. BigNum.library/BigNumToStr
  716.  
  717.    NAME
  718.     BigNumToStr -- Convert a BigNum to an ASCII string
  719.  
  720.    SYNOPSIS
  721.     BigNumToStr( big , string )
  722.              A0       A1
  723.  
  724.     void BigNumToStr(PtrBigNum,char *)
  725.  
  726.    FUNCTION
  727.     Convert a BigNum to a string.
  728.  
  729.    INPUTS
  730.     big    The BigNum you want to convert
  731.  
  732.    RESULT
  733.     string    The string.
  734.         It must be allocated in such a way it can contains ALL
  735.         the BigNum
  736.  
  737.    SEE ALSO
  738.     BigNumStrToBigNum(), BigNumPrint(), BigNumSize()
  739.  
  740.  
  741. BigNum.library/BigNumIntToBigNum
  742.  
  743.    NAME
  744.     BigNumIntToBigNum -- Convert an integer to a BigNum
  745.  
  746.    SYNOPSIS
  747.     BigNumIntToBigNum( big , number )
  748.                A0     D0
  749.  
  750.     void BigNumIntToBigNum(PtrBigNum,int)
  751.  
  752.    FUNCTION
  753.     Convert an integer to a BigNum.
  754.  
  755.    INPUTS
  756.     number    The integer you want to convert.
  757.  
  758.    RESULT
  759.     big    The output BigNum
  760.  
  761.    SEE ALSO
  762.     BigNumToInt()
  763.  
  764.  
  765. BigNum.library/BigNumToInt
  766.  
  767.    NAME
  768.     BigNumToInt -- Convert a BigNum to an integer
  769.  
  770.    SYNOPSIS
  771.     number = BigNumToInt( big )
  772.     D0              A0
  773.  
  774.     int BigNumToInt(PtrBigNum)
  775.  
  776.    FUNCTION
  777.     Convert a BigNum to an integer.
  778.  
  779.    INPUTS
  780.     big    The BigNum you want to convert.
  781.  
  782.    RESULT
  783.     number    The returned integer.
  784.  
  785.    WARNING
  786.     If the BigNum is too big, an error occured and number is set to 0.
  787.  
  788.    SEE ALSO
  789.     BigNumIntToBigNum()
  790.  
  791.  
  792. BigNum.library/BigNumCompare
  793.  
  794.    NAME
  795.     BigNumCompare -- Comparison between two BigNums
  796.  
  797.    SYNOPSIS
  798.     result = BigNumCompare( big1 , big2 )
  799.     D0            A0     A1
  800.  
  801.     int BigNumCompare(PtrBigNum,PtrBigNum)
  802.  
  803.    FUNCTION
  804.     Comparison function between two BigNums.
  805.  
  806.    INPUTS
  807.     big1,big2    The 2 BigNums.
  808.  
  809.    RESULT
  810.     result    1  if big1 > big2
  811.         -1 if big1 < big2
  812.         0  if big1 = big2
  813.  
  814.    SEE ALSO
  815.     BigNumFastCompare()
  816.  
  817.  
  818. BigNum.library/BigNumFastCompare
  819.  
  820.    NAME
  821.     BigNumFastCompare -- Comparison between two BigNums
  822.  
  823.    SYNOPSIS
  824.     result = BigNumFastCompare( big1 , big2 )
  825.     D0.w                A0       A1
  826.  
  827.     short BigNumFastCompare(PtrBigNum,PtrBigNum)
  828.  
  829.    FUNCTION
  830.     Comparison function betwwen two BigNums.
  831.  
  832.    INPUTS
  833.     big1,big2    The 2 BigNums.
  834.  
  835.    RESULT
  836.     result    1  if big1 > big2
  837.         -1 if big1 < big2
  838.         0  if big1 = big2
  839.  
  840.    NOTES
  841.     This function is the same as BigNumCompare except it doesn't
  842.     take care of the sign.
  843.  
  844.    SEE ALSO
  845.     BigNumCompare()
  846.  
  847.  
  848. BigNum.library/BigNumDiffCarre
  849.  
  850.    NAME
  851.     BigNumDiffCarre -- Factorisation function
  852.  
  853.    SYNOPSIS
  854.     result = BigNumDiffCarre( big , bigR, limit )
  855.     D0.w              A0     A1    D0
  856.  
  857.     short BigNumDiffCarre(PtrBigNum,PtrBigNum,int)
  858.  
  859.    FUNCTION
  860.     This function factorise a BigNumber, with the SquareDifference Method.
  861.  
  862.    INPUTS
  863.     big    The number you want to factorise.
  864.     limit    Breaking value
  865.         A number between 1 and 30
  866.         The higher it is, more precise will be the results,
  867.         but the delay increases !
  868.  
  869.    RESULT
  870.     bigR    A factor, if found.
  871.     result    -1    big is surely Prime
  872.         1    big is surely not prime        Check bigR
  873.         0    big is probably prime
  874.  
  875.    WARNING
  876.     There can be a long long delay until the function returns !
  877.  
  878.    NOTES
  879.     This method is usefull when x=AxB with A,B approximately
  880.     the same size.
  881.  
  882.    SEE ALSO
  883.     BigNumRho(), BigNumBrutePrime(), BigNumLucasLehmer()
  884.  
  885.  
  886. BigNum.library/BigNumRho
  887.  
  888.    NAME
  889.     BigNumRho -- Factorisation function
  890.  
  891.    SYNOPSIS
  892.     result = BigNumRho( big , bigR , limit )
  893.     D0.w            A0      A1     D0
  894.  
  895.     short BigNumRho(PtrBigNum,PtrBigNum,int)
  896.  
  897.    FUNCTION
  898.     This function factorise a BigNumber, with the Rho-Pollard Method.
  899.  
  900.    INPUTS
  901.     big    The number you want to factorise.
  902.     limit    Breaking value
  903.         A number between 1 and 30
  904.         The higher it is, more precise will be the results,
  905.         but the delay increases !
  906.  
  907.    RESULT
  908.     bigR    A factor, if found.
  909.     result    1    big is probably prime
  910.         0    big is not prime        Check bigR
  911.  
  912.    WARNING
  913.     There can be a long long delay until the function returns !
  914.  
  915.    NOTES
  916.     If it returns 1, the error is about 100*(0.25^limit) %
  917.     You can use several time this function because it is based
  918.     on random numbers.
  919.  
  920.    SEE ALSO
  921.     BigNumDiffCarre(), BigNumBrutePrime(), BigNumLucasLehmer()
  922.  
  923.  
  924. BigNum.library/BigNumBrutePrime
  925.  
  926.    NAME
  927.     BigNumBrutePrime -- Factorisation function
  928.  
  929.    SYNOPSIS
  930.     res = BigNumBrutePrime( big, aff)
  931.     D0.w                A0   D0
  932.  
  933.     short BigNumBrutePrime(PtrBigNum,int)
  934.  
  935.    FUNCTION
  936.     This function factorise a BigNumber, with the Brute method.
  937.  
  938.    INPUTS
  939.     big    The number you want to factorise.
  940.     aff    if 0 the found factor won't be printed.
  941.         You have no way to find it then.
  942.  
  943.    RESULT
  944.     res    1    Factor found big is surely Prime
  945.         0    Nothing. Surely prime.
  946.  
  947.    WARNING
  948.     There can be a long long delay until the function returns !
  949.     There are NO breakpoints.
  950.  
  951.    NOTES
  952.     DO NOT USE this method for BIG BigNumber, or do it
  953.     before you go on holiday ;)
  954.  
  955.    SEE ALSO
  956.     BigNumDiffCarre(), BigNumRho(), BigNumLucasLehmer()
  957.  
  958.  
  959. BigNum.library/BigNumLucasLehmer
  960.  
  961.    NAME
  962.     BigNumLucasLehmer -- Perform a LucasLehmer test.
  963.  
  964.    SYNOPSIS
  965.     result = BigNumLucasLehmer( power )
  966.     D0.w                        D0
  967.  
  968.     short BigNumLucasLehmer(int)
  969.  
  970.    FUNCTION
  971.     Perform a LucasLehmer test on (2^power)-1
  972.  
  973.    INPUTS
  974.     power    An integer.
  975.  
  976.    RESULT
  977.     result    1 if prime
  978.         0 otherwise
  979.  
  980.    SEE ALSO
  981.     BigNumRho(), BigNumBrutePrime(), BigNumDiffCarre()
  982.  
  983.  
  984. BigNum.library/BigNumRnd
  985.  
  986.    NAME
  987.     BigNumRnd -- Give a random BigNum
  988.  
  989.    SYNOPSIS
  990.     BigNumRnd( size , bigR )
  991.            D0      A0
  992.  
  993.     void BigNumRnd(int,PtrBigNum)
  994.  
  995.    FUNCTION
  996.     Compute a random BigNum between
  997.     ] 32768^(size-2) ... 32768^(size-1) ]
  998.  
  999.    INPUTS
  1000.     size    The size.
  1001.  
  1002.    RESULT
  1003.     bigR    The generated BigNum
  1004.  
  1005.    NOTES
  1006.     If size is too big, it will be round down to the bigger value
  1007.     BigNum.library can manage.
  1008.  
  1009.  
  1010. BigNum.library/BigNumPgcd
  1011.  
  1012.    NAME
  1013.     BigNumPgcd -- Find two BigNums GCD
  1014.  
  1015.    SYNOPSIS
  1016.     BigNumPgcd( big1 , big2 , bigR )
  1017.             A0       A1      A2
  1018.  
  1019.     void BigNumPgcd(PtrBigNum,PtrBigNum,PtrBigNum)
  1020.  
  1021.    FUNCTION
  1022.     Find the GCD of big1 and big2 and returns its value in bigR.
  1023.  
  1024.    INPUTS
  1025.     big1,big2
  1026.  
  1027.    RESULT
  1028.     bigR
  1029.  
  1030.    WARNING
  1031.     BigNumPgcd(x,y,x) is not allowed.
  1032.  
  1033.    NOTES
  1034.     if big <= 0 or big2 <= 0, bigR is set to 1 and an error occurs.
  1035.  
  1036.    SEE ALSO
  1037.     BigNumDiffCarre(), BigNumRho(), BigNumBrutePrime()
  1038.  
  1039.  
  1040. BigNum.library/BigNumPuiModulo
  1041.  
  1042.    NAME
  1043.     BigNumPuiModulo -- Compute the modulo power
  1044.  
  1045.    SYNOPSIS
  1046.     BigNumPuiModulo( big , power , modulus , bigR )
  1047.              A0    A1      A2     A3
  1048.  
  1049.     void BigNumPuiModulo(PtrBigNum,PtrBigNum,PtrBigNum,PtrBigNum)
  1050.  
  1051.    FUNCTION
  1052.  
  1053.     Compute in a fast way the modulo power.
  1054.  
  1055.    INPUTS
  1056.  
  1057.     big, power, modulus
  1058.  
  1059.    RESULT
  1060.     BigR    = ( big ^ power ) % modulus
  1061.  
  1062.    NOTES
  1063.     if power = 0 and big = 0
  1064.     or modulus = 0, an error occurs and bigR = 0.
  1065.  
  1066.    SEE ALSO
  1067.     BigNumModulo(), BigNumEDiv()
  1068.  
  1069.  
  1070. BigNum.library/BigNumSqrt
  1071.  
  1072.    NAME
  1073.     BigNumSqrt -- Square root function
  1074.  
  1075.    SYNOPSIS
  1076.     res = BigNumSqrt( big , bigR )
  1077.     D0.w              A0    A1
  1078.  
  1079.     short BigNumSqrt(PtrBigNum,PtrBigNum)
  1080.  
  1081.    FUNCTION
  1082.     Compute the square root of a given BigNum.
  1083.  
  1084.    INPUTS
  1085.     big    The BigNum you want to extract the root.
  1086.  
  1087.    RESULT
  1088.     bigR    The root
  1089.     ret    1 If the root is an exact value
  1090.         0 Otherwise
  1091.  
  1092.    WARNING
  1093.     If big is < 0, an error occurs and bigR is set to 0.
  1094.  
  1095.  
  1096. BigNum.library/BigNumSwap
  1097.  
  1098.    NAME
  1099.     BigNumSwap -- Swap two BigNums
  1100.  
  1101.    SYNOPSIS
  1102.     BigNumSwap( big1 , big2 )
  1103.             A0       A1
  1104.  
  1105.     void BigNumSwap(PtrBigNum,PtrBigNum)
  1106.  
  1107.    FUNCTION
  1108.     Swap two BigNums.
  1109.  
  1110.    INPUTS
  1111.     big1,big2
  1112.  
  1113.    RESULT
  1114.     big1 -> big2
  1115.     big2 -> big1
  1116.  
  1117.  
  1118. BigNum.library/BigNumAssign
  1119.  
  1120.    NAME
  1121.     BigNumAssign -- Assign a BigNum to another BigNum
  1122.  
  1123.    SYNOPSIS
  1124.     BigNumAssign( bigR , big )
  1125.               A0     A1
  1126.  
  1127.     void BigNumAssign(PtrBigNum,PtrBigNum)
  1128.  
  1129.    FUNCTION
  1130.     Assign a BigNum to another BigNum.
  1131.  
  1132.    INPUTS
  1133.     big
  1134.  
  1135.    RESULT
  1136.     bigR    = big
  1137.  
  1138.    NOTES
  1139.     Use this function instead of copy by hand the BigNum,
  1140.     for compatibility.
  1141.  
  1142.  
  1143. BigNum.library/BigNumPower2
  1144.  
  1145.    NAME
  1146.     BigNumPower2 -- Compute a power of two
  1147.  
  1148.    SYNOPSIS
  1149.     BigNumPower2( bigR , power )
  1150.               A0     D0
  1151.  
  1152.     void BigNumPower2(PtrBigNum,int)
  1153.  
  1154.    FUNCTION
  1155.     Compute the power of two.
  1156.  
  1157.    INPUTS
  1158.     power    An integer.
  1159.  
  1160.    RESULT
  1161.     bigR    = 2^power
  1162.  
  1163.    NOTES
  1164.     This is a very speedy routine !
  1165.  
  1166.    SEE ALSO
  1167.     BigNumLeftShift(), BigNumRightShift()
  1168.  
  1169.  
  1170. BigNum.library/BigNumErrorStatus
  1171.  
  1172.    NAME
  1173.     BigNumErrorStatus -- Return the current error status
  1174.  
  1175.    SYNOPSIS
  1176.     res = BigNumErrorStatus()
  1177.     D0.w
  1178.  
  1179.     short BigNumErrorStatus(void)
  1180.  
  1181.    FUNCTION
  1182.     Return the error status
  1183.  
  1184.    RESULT
  1185.     res    = 0 if no Error
  1186.  
  1187.    NOTES
  1188.     Check the includes to know what's happening
  1189.  
  1190.  
  1191. BigNum.library/BigNumInfo
  1192.  
  1193.    NAME
  1194.     BigNumInfo -- Display some informations
  1195.  
  1196.    SYNOPSIS
  1197.     BigNumInfo()
  1198.  
  1199.     void BigNumErrorStatus(void)
  1200.  
  1201.    FUNCTION
  1202.     Display some interesting informations.
  1203.  
  1204.